package com.itheima03.day15;

/**
 * @author 刘全
 * @date 2021/8/7
 */
public class TestDemo1 {
    public static void main(String[] args) {
        //死锁
        Object A = new Object();
        Object B = new Object();
        new Thread(() -> {
            while (true) {
                synchronized (A) {
                    synchronized (B) {
                        System.out.println("丕儿执行了");
                    }
                }
            }
        }).start();
        new Thread(() -> {
            while (true) {
                synchronized (B) {
                    synchronized (A) {
                        System.out.println("武儿执行了");
                    }
                }
            }
        }).start();
    }
}
